package com.fjut.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fjut.mapper.UserInfoMapper;
import com.fjut.model.user.UserInfo;
import com.fjut.service.UserInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import static com.fjut.dateBase.UserInfoField.OPEN_ID;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author DengTianxun
 * @since 2023-03-09
 */
@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {

    @Override
    public UserInfo getByOpenid(String openId) {
        if (openId == null) {
            return null;
        }
        QueryWrapper<UserInfo> wrapper = new QueryWrapper<>();
        wrapper.eq(OPEN_ID,openId);
        return baseMapper.selectOne(wrapper);
    }
}
